package com.podcstr.entity;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @author azim
 * @since 5/13/13 
 */

@Entity
@Table(name = "tb_series")
@NamedQueries({
        @NamedQuery(name = "tb_series.findById", query = "SELECT p FROM Series p WHERE p.id =:id"),
        @NamedQuery(name = "tb_series.findByName", query = "SELECT p FROM Series p WHERE p.name=:name"),
        @NamedQuery(name = "tb_series.findAllPodcasts", query = "SELECT p FROM Series p")
})
public class Series extends PersistanceObject {

    @NotNull
    private String name;

    @NotNull
    @Size(max = 200)
    private String description;

    @NotNull
    private String tags;

    @NotNull
    private boolean accessable;

    @OneToOne
    private User user;

    @OneToOne
    private Category category;

    @OneToMany
    private List<Podcast> podcasts;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getTags() {
        return tags;
    }

    public void setTags(String tags) {
        this.tags = tags;
    }

    public boolean isAccessable() {
        return accessable;
    }

    public void setAccessable(boolean accessable) {
        this.accessable = accessable;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public List<Podcast> getPodcasts() {
        return podcasts;
    }

    public void setPodcasts(List<Podcast> podcasts) {
        this.podcasts = podcasts;
    }
}
